class QueryEntity {
}

const app = new BasicTableVue({
    data: function () {
        return {
            api: netVpnInfoApi,
            columns: [
                TableColumn.generate({
                    type: 'selection',
                    width: 30,
                    align: 'center',
                }),
                TableColumn.generate({prop: 'id', title: 'ID', sortable: false, align: 'center'}),
                TableColumn.generate({prop: 'tunnelName', title: '隧道名称', sortable: false, align: 'center'}),
                TableColumn.generate({prop: 'localId', title: '本地标识', sortable: false, align: 'center'}),
                TableColumn.generate({prop: 'localIp', title: '本地IP地址', sortable: false, align: 'center'}),
                TableColumn.generate({prop: 'localSubnet', title: '本地子网', sortable: false, align: 'center'}),
                TableColumn.generate({prop: 'parnerId', title: '对方标识', sortable: false, align: 'center'}),
                TableColumn.generate({prop: 'parnerIp', title: '对方IP地址', sortable: false, align: 'center'}),
                TableColumn.generate({prop: 'parnerSubnet', title: '对方子网', sortable: false, align: 'center'}),
                // TableColumn.generate({prop: 'tunnelStatus', title: '隧道状态', sortable: false, align: 'center'}),
                TableColumn.generate({
                    prop: 'operating',
                    title: '操作',
                    customComponent: 'true',
                    sortable: false,
                    align: 'center',
                }),
            ],
        }
    },
    methods: {
        createForm() {
            return new QueryEntity();
        },
        async deleteOne(row) {
            const cfVal = await rxPrompt.confirm('是否确认删除', ['确认', '取消'])
            if (!cfVal) {
                return;
            }
            const res = await netVpnInfoApi.delete(row.id);
            if (res) {
                if (res.code == 200) {
                    await rxPrompt.msg('移除成功')
                    await this.searchPage()
                    return;
                }
            }
            await rxPrompt.msg('移除失败')

        },
        updateForward(data) {
            forward('/network-config/modify/admin_vpn_modify', data)
        },
    },
})